{include file="public/header" /}
<style type="text/css">
    .laydate-icon {
        background: transparent !important;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>用户列表</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">
                    <div class="table-responsive">
                        <div class="col-sm-12">
                            <form method="post" action="{:url('index')}" class="form-inline" id="searchForm">
                                <input placeholder="ID" class="form-control" name="id" value="{$id|default=''}" type="text">
                                <input placeholder="推广位" class="form-control" name="yx_pid" value="{$yx_pid|default=''}" type="text">
                                <input placeholder="微信名" class="form-control" name="nickname" value="{$nickname|default=''}" type="text">
                                
                                <label for="">类型</label>
                                {:getEnumSelectWidget(config("enum.customerCurrentLevel"), 'current_level', '-请选择用户类型-', isset($current_level) ? $current_level : '-999', 1)}
                                <button class="btn btn-success btn-sm" type="submit" style="margin-bottom:0;margin-left:4px"><i class="fa fa-filter"></i> 筛选</button>
                                <a class="btn btn-primary btn-sm"  style="margin-bottom:0" href="{:url('index')}"><i class="fa fa-filter"></i> 重置</a>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th>ID</th>
                                <th>微信名</th>
                                <th>类型</th>
                                <th>账户</th>
                                <th>推广位</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody id="list-content">
                            {foreach $list as $vo}
                                <tr class="long-td">
                                    <td>{$vo["id"]}</td>
                                    <td>{$vo.nickname}</td>
                                    <td>
                                        {if $vo.current_level == config('enum.c.ordinary.value')}
                                            <font style="color:green;">普通用户</font>
                                        {elseif $vo.current_level == config('enum.customerCurrentLevel.store.value')}
                                            <font style="color:red;">店长</font>
                                        {elseif $vo.current_level == config('enum.customerCurrentLevel.largeStore.value')}
                                            <font style="color:cadetblue;">超级店长</font>
                                        {elseif $vo.current_level == config('enum.customerCurrentLevel.agent.value')}
                                            <font style="color:blue;">总代理</font>
                                        {/if}
                                    </td>
                                    <td>{$vo.history_profit}</td>
                                    <td>{$vo["yx_pid"]}</td>
                                    <td>{$vo["create_time"]}</td>
                                    <td>
                                        <div class="dropdown">
                                            <button class="btn btn-primary btn-xs dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                                                <i class="fa fa-gear"></i> 操作
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                                                <li><a href="{:url('edit', ['id'=>$vo['id']])}">编辑</a></li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                            {/foreach}
                        </tbody>
                    </table>
                    <div id="laypage">
                        {$list->render()}
                    </div>
                </div>
            </div>
            <!-- End Example Pagination -->
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/js/laypage.js"></script>
<script type="text/javascript">

layui.use(['laypage', 'layer'], function(){
  var laypage = layui.laypage
  ,layer = layui.layer;

  //完整功能
  laypage.render({
    elem: 'laypage'
    ,count: '{$list->total()}' // 总数据条数
    ,curr: '{$list->currentPage()}' // 当前第几页
    ,limit: '{$list->listRows()}'   // 每页显示条数
    ,layout: ['count', 'prev', 'page', 'next', 'refresh', 'skip']
    ,jump: function(obj, first){
      //首次不执行
      if(!first){
            $("#searchForm").attr('action', '{:url("index")}?page='+obj.curr);
          $("#searchForm").submit();
      }
    }
  });
});

    var myDate = new Date();
    myDate.getYear();        //获取当前年份(2位)
    myDate.getFullYear();    //获取完整的年份(4位,1970-????)
    myDate.getMonth();       //获取当前月份(0-11,0代表1月)
    myDate.getDate();        //获取当前日(1-31)

    var currentMonth = Appendzero(myDate.getMonth()+1);
    var currentDate = myDate.getFullYear()+'-'+currentMonth+'-'+myDate.getDate();

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        // 年月范围
        laydate.render({
          elem: "#createTime",
          type: 'date',
          max: currentDate,
          range: true,
            done: function(value, date){
              $("input[name='createTime']").val(value);
            }
        });

    });

    function Appendzero(obj)
    {
        if(obj<10) return "0" +""+ obj;
        else return obj;
    }
</script>

</body>
</html>